#ifndef UNIT_H
#define UNIT_H


#include <sstream>
#include <PrintFormat.h>

struct UNIT_TYPE 
{
  UNIT_TYPE() {}
};


struct Unit
{
  int getAmountInBaseUnit(const int amount) const;
  virtual const Unit& getBaseUnit() const = 0;
  bool isSameType (const Unit& unit) const;
  const std::string getAndPrint(const PrintFormat& format, int amount) const;

protected:
  Unit(const UNIT_TYPE& type, const int factorOfBaseUnit);
  void printOneUnit( std::ostringstream& os,int& amountLeftInBaseUnit) const;  
  virtual const std::string getUnitString() const {return "InValid";}
  virtual std::string printEveryUnit(const PrintFormat& format , int amountLeftInBaseUnit) const {return "InValid";}

protected:
  int  factorOfBaseUnit;
private:
  const UNIT_TYPE&  type;
  
};


struct InvalidUnit:Unit
{

  virtual const Unit& getBaseUnit() const;
  static const InvalidUnit& Invalid();
  const std::string getAndPrint(int amount) const { return "";}

private:
  explicit InvalidUnit(const int factorOfBaseUnit);

};

#define INVALID InvalidUnit::Invalid()


#endif
